let BaseParser = require('./BaseParser');

class QuestionsParser extends BaseParser {
    constructor() {
        super('QuestionParser');
    }
    parser(body) {
        let $ = this.cheerio.load(body, { decodeEntities: false });
        return this.toMoal($)
    }
    toMoal($) {
        let data = null;
        $('body').find('script').each((index, item) => {
            if (index == 19) {
                let scriptText = $(item).html();
                let splits0 = scriptText.split('var MockDataTestPaper = ')
                let splits1 = splits0[1].split('if (MockDataTestPaper[0]')
                let splits2 = splits1[0].split('];');
                let resultStr = splits2[0] + "]"
                data = JSON.parse(resultStr);
            }
        })
        console.log(data);
        return data;

    }
}


module.exports = QuestionsParser;